var path = require('path')
var webpack = require('webpack')
var { VueLoaderPlugin } = require('vue-loader')

var package = require('./../package.json')

module.exports = {
    output: {
        path: path.resolve(__dirname, '..', 'dist')
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                use: ['vue-loader']
            },
            {
                test: /\.css/,
                use: ['style-loader', 'css-loader']
            }
        ]
    },
    optimization: {
        chunkIds: 'natural',
        mangleWasmImports: true
    },
    plugins: [
        new webpack.DefinePlugin({
            version: JSON.stringify(package.version)
        }),
        new VueLoaderPlugin(),
        new webpack.LoaderOptionsPlugin({
            vue: {
                compilerOptions: {
                    preserveWhitespace: false
                }
            }
        })
    ],
    resolve: {
        extensions: ['.js', '.vue']
    }
}